import request from "@/utils/request";
/**
 * 商品列表
 * @param {string} type - 1:商品，2：会员服务，3：自营商品,该字段必传
 */
export function getGoodsBaseList(query) {
  return request({
    url: "cms-shop/api/goods-base/list",
    method: "get",
    params: query,
  });
}

// 根据id获取商品列表
export function getGoodsBaseInfo(query) {
  return request({
    url: `cms-shop/api/goods-base/${query}`,
    method: "get",
  });
}

// 商品列表删除
export function delGoodsBaseType(data) {
  return request({
    url: `/cms-shop/api/goods-base/${data.id}`,
    method: "delete",
  });
}
// 商品列表添加
export function addGoodsBaseType(data) {
  return request({
    url: "/cms-shop/api/goods-base",
    method: "post",
    data: data,
  });
}

// 商品列表导出
export function exportGoodsBaseType(query) {
  return request({
    url: `/cms-shop/api/goods-base/export`,
    method: "get",
    params: query,
  });
}

// 商品列表编辑
export function editGoodsBaseType(data) {
  return request({
    url: `/cms-shop/api/goods-base`,
    method: "put",
    data: data,
  });
}
// 上下架
export function editGoodsGroundingType(data) {
  return request({
    url: `/cms-shop/api/goods-base/grounding`,
    method: "put",
    data: data,
  });
}